<template>
	<view style="padding-right: 20rpx;">
		<view class="item" v-for="(item, index) in itemList" :key="item.id" @click="toGoodsDetail(item.id)">
			<view class="item-img">
				<image :src="item.imgurl"></image>
			</view>
			<view class="item-info">
				<view class="item-top">{{ item.title }}</view>
				<view class="item-middle">
					<view class="tag" style="margin: 10rpx 0;" v-show="item.rent_label.length !== 0">
						<text v-for="(items,index1) in item.rent_label" :key="index1" :style="{backgroundColor: index1 === 0 ? 'rgba(0, 255, 0, .1)' : null, color: index1 === 0 ? '#00ff00' : null}" v-show="items !== ''">{{ items }}</text>
					</view>
				</view>
				<view class="item-bottom">
					<view class="item-price" style="color: #ff0000; font-size:30rpx;">￥{{ item.min_price }}/天</view>
					<view class="item-day" style="color: #999; font-size: 20rpx;">{{ item.min_lease_term }}天起租</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"mallGoodsCard",
		props: {
			itemList: {
				type: Array
			}
		},
		data() {
			return {
				
			};
		},
		methods: {
			toGoodsDetail(id) {
				uni.navigateTo({
					url: `/pagesA/category/goods/productDetails/productDetails?id=${ id }`
				})
			}
		}
	}
</script>

<style scoped>
	.item {
		margin-top: 20rpx;
		padding: 20rpx;
		display: flex;
		background-color: #fff;
		font-size: 30rpx;
		border-radius: 10rpx;
	}
	.item-img {
		width: 25%;
	}
	.item-img image {
		height: 150rpx;
		width: 150rpx;
	}
	.item-info {
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		width: 70%;
	}
	.item-middle {
		font-size: 25rpx;
	}
	.tabs {
		margin-right: 15rpx;
	}
	.item-bottom {
		display: flex;
		justify-content: space-between;
	}
	.tag text {
		display: inline-block;
		font-size: 20rpx;
		margin-left: 10rpx;
		background-color: rgba(255, 0, 0, .1); 
		color: #ff0000;
	}
</style>